import React from 'react';
import {
  Form,
  Modal,
} from 'antd';

import DescriptionList from '@/components/DescriptionList';
import { repayMode, repayStatus } from '../../../common/options';

const { Description } = DescriptionList;

// 查看详情
const DescView = Form.create()(props => {
  const { lookDescView, handleLookDesc, selectedRows } = props;

  return (
    <Modal
      width={640}

      destroyOnClose
      title="查看还款信息"
      visible={lookDescView}
      onOk={() => handleLookDesc(false,[])}
      onCancel={() => handleLookDesc(false, [])}>
      <DescriptionList size="large" style={{ marginBottom: 32 }} col="2">
        <Description term="还款编号">{selectedRows.repaymentNo}</Description>
        <Description term="企业编号">{selectedRows.enterpriseNo}</Description>
        <Description term="企业名称">{selectedRows.enterpriseName}</Description>
        <Description term="项目名称">{selectedRows.projectName}</Description>
        <Description term="项目编号">{selectedRows.projectNo}</Description>

        <Description term="融资方式">{Number(selectedRows.financeMode) === 1 ? '直借' : '保理'}</Description>
        <Description term="还款方式">{repayMode.map(item => (
          item.key === selectedRows.repayMode ? item.value : ''
        ))}</Description>
        <Description term="还款时间">{selectedRows.repayTime}</Description>
        <Description term="回款时间">{selectedRows.backTime}</Description>
        <Description term="账单金额">{selectedRows.amount}</Description>
        <Description term="本金">{selectedRows.principal}</Description>
        <Description term="利息">{selectedRows.interest}</Description>
        <Description term="服务费">{selectedRows.fee}</Description>
        <Description term="状态">{repayStatus.map(item => (
          item.key === selectedRows.repayMode ? item.value : ''
        ))}</Description>
        <Description term="创建时间">{selectedRows.createTime}</Description>
      </DescriptionList>
    </Modal>
  );
});

export default DescView;
